/*
 * @Author: WangLi
 * @Date: 2024-03-10 09:13:33
 * @LastEditors: WangLi
 * @LastEditTime: 2024-05-10 19:20:59
 */
import WPage from "../../common/WPage";
import { getUuid, writeBLECharacteristicValue } from "../../utils/common";
WPage({
  data: {
    title: "手动模式",
    unlockActionTime: 0,
    unlockGapTime: 0,
    unlockCount: 0,
    lockActionTime: 0,
    lockGapTime: 0,
    lockCount: 0,
  },
  onLoad(options) {
    this.init();
  },
  onShow() {
    this.init();
  },
  init() {},
  handleSubmit() {
    const { unlockActionTime, unlockGapTime, unlockCount, lockActionTime, lockGapTime, lockCount } = this.data;
    const serviceId = getUuid("5501");
    writeBLECharacteristicValue(serviceId, getUuid("0010"), unlockActionTime);
    writeBLECharacteristicValue(serviceId, getUuid("0011"), unlockGapTime);
    writeBLECharacteristicValue(serviceId, getUuid("0012"), unlockCount);
    writeBLECharacteristicValue(serviceId, getUuid("0013"), lockActionTime);
    writeBLECharacteristicValue(serviceId, getUuid("0014"), lockGapTime);
    writeBLECharacteristicValue(serviceId, getUuid("0015"), lockCount);
    writeBLECharacteristicValue(serviceId, getUuid("FF10"), "", "保存");
  },
});
